package com.cie2.janji.services;

import java.util.List;

import org.hibernate.Session;

import com.cie2.janji.entities.EntityRole;

public class EntityRoleService {

	private Session session;
	
	public EntityRoleService(Session session) {
		this.session = session;
	}
	
	public void add(EntityRole role) {
		session.persist(role);
		session.flush();
	}
	
	public List getAll() {
		return session.createCriteria(EntityRole.class).list();
	}

	public EntityRole load(Long roleId) {
		return (EntityRole) session.load(EntityRole.class, roleId);
	}
}
